package com.demo.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.demo.domain.Post;
import org.apache.ibatis.annotations.*;

import java.math.BigInteger;
import java.util.List;

@Mapper
public interface PostDao extends BaseMapper<Post> {
//    增加对应id的队伍的评论数
    @Update("UPDATE tb_post p set p.p_comments=p.p_comments+1 where p.p_id = #{pid}")
    void incrementCommentsByPid(Long pid);

    @Select("SELECT p_id FROM tb_post p where p.p_uid = #{uid} and p.p_del_flag = 0")
    List<Long> selectPidByuid(Long uid);

    @Select("SELECT p_uid FROM tb_post p where p.p_id = #{id} and p.p_del_flag = 0")
    Long selectUidBypid(Long id);

}
